﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Styx.Common;
using System.Windows.Media;

namespace YourBuddy_MoP
{
    public partial class YBMOP_GUI : Form
    {
        #region Initialize
        public YBMOP_GUI()
        {
            InitializeComponent();
        }
        #endregion

        #region GUI Load
        private void YBMOP_GUI_Load(object sender, EventArgs e)
        {
            YBMOP_Settings.Instance.Load();
            RTO_Use.SelectedItem = (string)YBMOP_Settings.Instance.RTO_Use;
            CDO_Use.SelectedItem = (string)YBMOP_Settings.Instance.CDO_Use;
            WBO_Use.SelectedItem = (string)YBMOP_Settings.Instance.WBO_Use;
            PCO_Shout.SelectedItem = (string)YBMOP_Settings.Instance.PCO_Shout;
            PRO_Rot.SelectedItem = (string)YBMOP_Settings.Instance.PRO_Rot;
            WBO_WB.SelectedItem = (string)YBMOP_Settings.Instance.WBO_WB;
            RTO_6.Checked = YBMOP_Settings.Instance.RTO_6;
            RTO_4.Checked = YBMOP_Settings.Instance.RTO_4;
            CDO_BR.Checked = YBMOP_Settings.Instance.CDO_BR;
            CDO_DC.Checked = YBMOP_Settings.Instance.CDO_DC;
            CDO_RC.Checked = YBMOP_Settings.Instance.CDO_RC;
            CDO_RS.Checked = YBMOP_Settings.Instance.CDO_RS;
            ORO_AOE.Checked = YBMOP_Settings.Instance.ORO_AOE;
            ORO_HT.Checked = YBMOP_Settings.Instance.ORO_HT;
            ORO_IR.Checked = YBMOP_Settings.Instance.ORO_IR;
            ORO_SA.Checked = YBMOP_Settings.Instance.ORO_SA;
            ORO_ST.Checked = YBMOP_Settings.Instance.ORO_ST;
            ORO_Trink1.Checked = YBMOP_Settings.Instance.ORO_Trink1;
            ORO_Trink2.Checked = YBMOP_Settings.Instance.ORO_Trink2;
            ORO_SH.Checked = YBMOP_Settings.Instance.ORO_SH;
        }
        #endregion

        #region Link Label
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://www.thebuddyforum.com/honorbuddy-forum/combat-routines/warrior/80375-dps-fury-yourbuddy-mop.html");
            linkLabel1.LinkVisited = true;
        }
        #endregion

        #region Rotational Tier Options
        private void RTO_6_CheckedChanged(object sender, EventArgs e)
        {
            if (RTO_6.Checked == true)
            {
                YBMOP_Settings.Instance.RTO_6 = true;
            }
            else
            {
                YBMOP_Settings.Instance.RTO_6 = false;
            }
        }
        private void RTO_4_CheckedChanged(object sender, EventArgs e)
        {
            if (RTO_4.Checked == true)
            {
                YBMOP_Settings.Instance.RTO_4 = true;
            }
            else
            {
                YBMOP_Settings.Instance.RTO_4 = false;
            }
        }
        private void RTO_Use_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch ((string)RTO_Use.SelectedItem)
            {
                case "Always":
                    YBMOP_Settings.Instance.RTO_Use = (string)RTO_Use.SelectedItem;
                    break;
                case "Never":
                    YBMOP_Settings.Instance.RTO_Use = (string)RTO_Use.SelectedItem;
                    break;
                case "On Bloodlust & Time Warp":
                    YBMOP_Settings.Instance.RTO_Use = (string)RTO_Use.SelectedItem;
                    break;
                case "On Boss & Dummy":
                    YBMOP_Settings.Instance.RTO_Use = (string)RTO_Use.SelectedItem;
                    break;
            }
        }
        #endregion

        #region Cooldown Options
        private void CDO_BR_CheckedChanged(object sender, EventArgs e)
        {
            if (CDO_BR.Checked == true)
            {
                YBMOP_Settings.Instance.CDO_BR = true;
            }
            else
            {
                YBMOP_Settings.Instance.CDO_BR = false;
            }
        }
        private void CDO_DC_CheckedChanged(object sender, EventArgs e)
        {
            if (CDO_DC.Checked == true)
            {
                YBMOP_Settings.Instance.CDO_DC = true;
            }
            else
            {
                YBMOP_Settings.Instance.CDO_DC = false;
            }
        }
        private void CDO_RC_CheckedChanged(object sender, EventArgs e)
        {
            if (CDO_RC.Checked == true)
            {
                YBMOP_Settings.Instance.CDO_RC = true;
            }
            else
            {
                YBMOP_Settings.Instance.CDO_RC = false;
            }
        }
        private void CDO_RS_CheckedChanged(object sender, EventArgs e)
        {
            if (CDO_RS.Checked == true)
            {
                YBMOP_Settings.Instance.CDO_RS = true;
            }
            else
            {
                YBMOP_Settings.Instance.CDO_RS = false;
            }
        }
        private void CDO_Use_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch ((string)CDO_Use.SelectedItem)
            {
                case "Always":
                    YBMOP_Settings.Instance.CDO_Use = (string)CDO_Use.SelectedItem;
                    break;
                case "Never":
                    YBMOP_Settings.Instance.CDO_Use = (string)CDO_Use.SelectedItem;
                    break;
                case "On Bloodlust & Time Warp":
                    YBMOP_Settings.Instance.CDO_Use = (string)CDO_Use.SelectedItem;
                    break;
                case "On Boss & Dummy":
                    YBMOP_Settings.Instance.CDO_Use = (string)CDO_Use.SelectedItem;
                    break;
            }
        }
        #endregion

        #region Pre-Combat Options
        private void PCO_Shout_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch ((string)PCO_Shout.SelectedItem)
            {
                case "Battle Shout":
                    YBMOP_Settings.Instance.PCO_Shout = (string)PCO_Shout.SelectedItem;
                    break;
                case "Commanding Shout":
                    YBMOP_Settings.Instance.PCO_Shout = (string)PCO_Shout.SelectedItem;
                    break;
            }
        }
        #endregion

        #region Preferred Rotation Options
        private void PRO_Rot_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch ((string)PRO_Rot.SelectedItem)
            {
                case "Default Fury Routine":
                    YBMOP_Settings.Instance.PRO_Rot = (string)PRO_Rot.SelectedItem;
                    break;
                //case "Icy Veins Combat Routine":
                //    YBMOP_Settings.Instance.PRO_Rot = (string)PRO_Rot.SelectedItem;
                //    break;
                //case "SimCraft Combat Routine":
                //    YBMOP_Settings.Instance.PRO_Rot = (string)PRO_Rot.SelectedItem;
                //    break;
            }
        }
        #endregion

        #region War Banner Options
        private void WBO_WB_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch ((string)WBO_WB.SelectedItem)
            {
                case "Demoralizing Banner":
                    YBMOP_Settings.Instance.WBO_WB = (string)WBO_WB.SelectedItem;
                    break;
                case "Mocking Banner":
                    YBMOP_Settings.Instance.WBO_WB = (string)WBO_WB.SelectedItem;
                    break;
                case "Skull Banner":
                    YBMOP_Settings.Instance.WBO_WB = (string)WBO_WB.SelectedItem;
                    break;
            }
        }
        private void WBO_Use_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch ((string)WBO_Use.SelectedItem)
            {
                case "Always":
                    YBMOP_Settings.Instance.WBO_Use = (string)WBO_Use.SelectedItem;
                    break;
                case "Never":
                    YBMOP_Settings.Instance.WBO_Use = (string)WBO_Use.SelectedItem;
                    break;
                case "On Bloodlust & Time Warp":
                    YBMOP_Settings.Instance.WBO_Use = (string)WBO_Use.SelectedItem;
                    break;
                case "On Boss & Dummy":
                    YBMOP_Settings.Instance.WBO_Use = (string)WBO_Use.SelectedItem;
                    break;
            }
        }
        #endregion

        #region Other Rotational Options
        private void ORO_AOE_CheckedChanged(object sender, EventArgs e)
        {
            if (ORO_AOE.Checked == true)
            {
                YBMOP_Settings.Instance.ORO_AOE = true;
            }
            else
            {
                YBMOP_Settings.Instance.ORO_AOE = false;
            }
        }
        private void ORO_HT_CheckedChanged(object sender, EventArgs e)
        {
            if (ORO_HT.Checked == true)
            {
                YBMOP_Settings.Instance.ORO_HT = true;
            }
            else
            {
                YBMOP_Settings.Instance.ORO_HT = false;
            }
        }
        private void ORO_IR_CheckedChanged(object sender, EventArgs e)
        {
            if (ORO_IR.Checked == true)
            {
                YBMOP_Settings.Instance.ORO_IR = true;
            }
            else
            {
                YBMOP_Settings.Instance.ORO_IR = false;
            }
        }
        private void ORO_SA_CheckedChanged(object sender, EventArgs e)
        {
            if (ORO_SA.Checked == true)
            {
                YBMOP_Settings.Instance.ORO_SA = true;
            }
            else
            {
                YBMOP_Settings.Instance.ORO_SA = false;
            }
        }
        private void ORO_ST_CheckedChanged(object sender, EventArgs e)
        {
            if (ORO_ST.Checked == true)
            {
                YBMOP_Settings.Instance.ORO_ST = true;
            }
            else
            {
                YBMOP_Settings.Instance.ORO_ST = false;
            }
        }
        private void ORO_Trink1_CheckedChanged(object sender, EventArgs e)
        {
            if (ORO_Trink1.Checked == true)
            {
                YBMOP_Settings.Instance.ORO_Trink1 = true;
            }
            else
            {
                YBMOP_Settings.Instance.ORO_Trink1 = false;
            }
        }
        private void ORO_Trink2_CheckedChanged(object sender, EventArgs e)
        {
            if (ORO_Trink2.Checked == true)
            {
                YBMOP_Settings.Instance.ORO_Trink2 = true;
            }
            else
            {
                YBMOP_Settings.Instance.ORO_Trink2 = false;
            }
        }
        private void ORO_SH_CheckedChanged(object sender, EventArgs e)
        {
            if (ORO_SH.Checked == true)
            {
                YBMOP_Settings.Instance.ORO_SH = true;
            }
            else
            {
                YBMOP_Settings.Instance.ORO_SH = false;
            }
        }
        #endregion

        #region MouseOvers
        private void RTO_6_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Avatar, Bloodbath or Stormbolt";
        }

        private void RTO_4_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Bladestorm, Dragon Roar or Shockwave";
        }

        private void CDO_BR_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Berserker Rage to trigger Enrage aura";
        }

        private void CDO_DC_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Deadly Calm";
        }

        private void CDO_RS_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Racial Skills";
        }

        private void CDO_RC_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Recklessness";
        }

        private void ORO_AOE_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables AoE rotation";
        }

        private void ORO_HT_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Heroic Throw";
        }

        private void ORO_IR_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Interrupts";
        }

        private void ORO_ST_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Shattering Throw";
        }

        private void ORO_SA_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Sunder Armor";
        }

        private void ORO_Trink1_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Trinket in first trinketslot";
        }

        private void ORO_Trink2_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables Trinket in second trinketslot";
        }

        private void ORO_SH_MouseMove(object sender, MouseEventArgs e)
        {
            YBToolStripStatus.Text = "Enables selfhealing abilities (Enraged Regenration, Impending Victory and/or Victory Rush";
        }
        #endregion

        #region SaveButton
        private void SaveButton_Click(object sender, EventArgs e)
        {
            YBMOP_Settings.Instance.Save();
            Logging.Write(Colors.Red, "Settings for YourBuddy MoP saved!");
            Close();
        }
        #endregion

    }
}